//
//  PPHTTPRequest.h
//  PPNetworkHelper
//
//  Created by AndyPang on 2017/4/10.
//  Copyright © 2017年 AndyPang. All rights reserved.
//


#import <Foundation/Foundation.h>
#import "SJInterfaceConst.h"
#import "ASFileConfig.h"
/*
 以下Block的参数你根据自己项目中的需求来指定, 这里仅仅是一个演示的例子
 */
/**
 请求成功的block

 @param response 响应体数据
 */
typedef void(^PPRequestSuccess)(id response);
/**
 请求失败的block
 
 @param error 扩展信息
 */
typedef void(^PPRequestFailure)(NSError *error);

typedef void(^PPRequestProgress)(NSInteger progress);

typedef void(^PPRequestCache)(id responseCache);

typedef NS_ENUM(NSInteger,ASResponseStatus) {
    ASResponseSuccess,      /**< 接口请求成功*/
    ASResponseFail,         /**< 接口请求失败*/
    ASResponseTokenInvalid  /**< 登录失效*/
};

@interface PPHTTPRequest : NSObject
/**
 不带缓存的post请求

 @param URL 请求地址后缀
 @param parameters 请求参数
 @param success 请求成功回调
 @param failure 请求失败回调
 @return 当前网络请求任务
 */
+ (NSURLSessionTask *)postWithURL:(NSString *)URL parameters:(id)parameters loadStr:(NSString *)loadStr isLoad:(BOOL)isLoad sucess:(PPRequestSuccess)success failure:(PPRequestFailure)failure;

/**
 不带缓存的get请求
 
 @param URL 请求地址后缀
 @param parameters 请求参数
 @param success 请求成功回调
 @param failure 请求失败回调
 @return 当前网络请求任务
 */
+ (NSURLSessionTask *)getWithURL:(NSString *)URL parameters:(id)parameters  loadStr:(NSString *)loadStr isLoad:(BOOL)isLoad sucess:(PPRequestSuccess)success failure:(PPRequestFailure)failure;

+ (NSURLSessionTask *)uploadFilesWithURL:(NSString *)URL params:(id)params files:(NSArray *)files progress:(PPRequestProgress)uploadProgress  success:(PPRequestSuccess)success failure:(PPRequestFailure)failure;

+ (NSURLSessionTask *)uploadFileWithURL:(NSString *)URL params:(id)params name:(NSString *)name filePath:(NSString *)filePath success:(PPRequestSuccess)success failure:(PPRequestFailure)failure;

+ (NSURLSessionTask *)uploadImageWithURL:(NSString *)URL params:(id)params name:(NSString *)name images:(NSArray *)images fileNames:(NSArray<NSString *> *)fileNames imageScale:(CGFloat)imageScale imageType:(NSString *)imageType success:(PPRequestSuccess)success failure:(PPRequestFailure)failure;
@end
                                                                                 

